﻿#pragma once

#ifndef QCEFPROTOCOL_H
#define QCEFPROTOCOL_H

// These flags must match the Chromium values.
#define kProcessType                "type"
#define kRendererProcess            "renderer"

// CEF and Chromium support a wide range of command-line switches. This file
// only contains command-line switches specific to the cefclient application.
// View CEF/Chromium documentation or search for *_switches.cc files in the
// Chromium source code to identify other existing command-line switches.
// Below is a partial listing of relevant *_switches.cc files:
//   base/base_switches.cc
//   cef/libcef/common/cef_switches.cc
//   chrome/common/chrome_switches.cc (not all apply)
//   content/public/common/content_switches.cc

#define kMultiThreadedMessageLoop   "multi-threaded-message-loop"
#define kExternalMessagePump        "external-message-pump"
#define kCachePath                  "cache-path"
#define kUrl                        "url"
#define kOffScreenRenderingEnabled  "off-screen-rendering-enabled"
#define kOffScreenFrameRate         "off-screen-frame-rate"
#define kTransparentPaintingEnabled "transparent-painting-enabled"
#define kShowUpdateRect             "show-update-rect"
#define kSharedTextureEnabled       "shared-texture-enabled"
#define kExternalBeginFrameEnabled  "external-begin-frame-enabled"
#define kMouseCursorChangeDisabled  "mouse-cursor-change-disabled"
#define kOffline                    "offline"
#define kRequestContextPerBrowser   "request-context-per-browser"
#define kRequestContextSharedCache  "request-context-shared-cache"
#define kBackgroundColor            "background-color"
#define kEnableGPU                  "enable-gpu"
#define kFilterURL                  "filter-url"
#define kUseViews                   "use-views"
#define kHideFrame                  "hide-frame"
#define kHideControls               "hide-controls"
#define kAlwaysOnTop                "always-on-top"
#define kHideTopMenu                "hide-top-menu"
#define kWidevineCdmPath            "widevine-cdm-path"
#define kSslClientCertificate       "ssl-client-certificate"
#define kCRLSetsPath                "crl-sets-path"
#define kLoadExtension              "load-extension"
#define kNoActivate                 "no-activate"


//browser 和 render 进程间通信的信息

/// <summary>
///
/// </summary>
#define kQCefBridgeObjectNameKey "bridge-obj-name"

/// <summary>
///
/// </summary>
#define kQCefDefaultBridgeObjectName "QCefClient"


/// <summary>
/// this message is sent from render process to browser process
/// and is processed in the Qt UI thread
///
/// </summary>
#define kQCefRenderReportJavaScriptResultMessage "QCefRender.ReportJavaScriptResult"

/// <summary>
/// this message is sent from render process to browser process
/// and is processed in the Qt UI thread
///
/// format
///   msg.name
///   msg.arg[0]: function name
///   msg.arg[1~...]: function parameters
/// </summary>
#define kQCefRenderInvokeMethodMessage "QCefRender.InvokeMethod"

/// <summary>
/// this message is sent from browser process to render process
/// and is processed in the CefRenderer_Main thread
///
/// format:
///   msg.name:
///   msg.arg[0]: function name
///   msg.arg[1~...]: function parameters
/// </summary>
#define kQCefBrowserTriggerEventMessage "QCefBrowser.TriggerEvent"

/// <summary>
/// window.__report_js_result__(context, result)
/// context must be int
/// </summary>
#define kQCefReportJavaScriptResultFunctionName "__report_js_result__"


/// <summary>
/// this message is sent from render process to browser process
/// and is processed in the Qt UI thread
///
/// </summary>
#define kCefViewClientRenderFocusedNodeChangedMessage "CefViewClientRender.FocusedNodeChanged"

#endif // QCEFPROTOCOL_H
